/* GAME */
//Can be Menu, Phase 1, Phase 2
var currentPhase = '';
var sceneMenu = new Container();
var sceneP1 = new Container();
var refBullets = new Array;
var bullets = new Array();
var bulletsImg = new Container();
var sceneP2 = new Container();

var boutonJouer ;
var boutonRound1;
var boutonRound2;
var boutonReady;

var doUpdate = false;

/*FOND*/
var arene;

/* BOTS2 */
var b1;
var bot1;

var b2;
var bot2;

/*TABLEAU BONUS*/
var tableauBonus = new Array();
tableauBonus[0] = new Bonus();
Bonus.tableauBonus = true;
//Bonus.tableauBonus = false;
//Bonus.setWidth(screenWidth);
var rand = tableauBonus[Math.floor(Math.random() * tableauBonus.length)];

/*RAIL*/
var railFixe;
var railMobile1;
var railMobile2;

/*BOUTONS ATK*/
var atkMag1, atkElec1, atkMech1;

var atkMag2, atkElec2, atkMech2;

function update()
{
	if(currentPhase == 'Menu')
	{

		MenuUpdate();

	}
	else if(currentPhase == 'Phase 1')
	{

		Phase1Update();

	}
	else if (currentPhase == 'Phase 2')
	{

		Phase2Update();

	}

	if(doUpdate)
	{
		doUpdate = false;
		stage.update();

	}
	
}



function MenuUpdate()
{
	
	

}

/* PHASE 1 */



function Phase1Update()
{
	//Mouvement du rail
	railMobile1.x -= 1;
	railMobile2.x -= 1;
	if(railMobile1.x <= -screenWidth)
		railMobile1.x = screenWidth;
	if(railMobile2.x <= -screenWidth)
		railMobile2.x = screenWidth;



	
}

/* PHASE 2 */


function Phase2Update()
{
	
	for(var i =0;i<bullets.length;i++)
	{

		bullets[i].onUpdate();
		
	}

}